package com.xiaoyu.tool.configuration.filter;

import com.xiaoyu.tool.filter.AdminLoginFilter;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 登录拦截器配置
 * */
@Configuration
public class AdminLoginFilterConfiguration {
    
    @Bean
    public FilterRegistrationBean adminUserFilterRegistrationBean(@Qualifier("adminLoginFilter") AdminLoginFilter adminLoginFilter){
        FilterRegistrationBean registrationBean = new FilterRegistrationBean();
        registrationBean.setFilter(adminLoginFilter);
        registrationBean.addUrlPatterns("/admin/*");
        registrationBean.addUrlPatterns("/admin/**");
        registrationBean.setName("admin_user_filter_registration");
        registrationBean.setOrder(1);
        return registrationBean;
    }

}
